FROM alpine:3.21.3
LABEL maintainer="Caden"

RUN wget 'http://openresty.org/package/admin@openresty.com-5ea678a6.rsa.pub' \
    && mv 'admin@openresty.com-5ea678a6.rsa.pub' /etc/apk/keys/ \
    && echo "http://openresty.org/package/alpine/v3.15/main" > /etc/apk/repositories \
    && echo http://mirrors.aliyun.com/alpine/v3.21/main/ >> /etc/apk/repositories \
    && echo http://mirrors.aliyun.com/alpine/v3.21/community/ >> /etc/apk/repositories \
    && apk add --no-cache tzdata \
    && apk add openresty \
    && cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
    && echo "Asia/Shanghai" > /etc/timezone \
    && apk del tzdata \
    && rm -rf /var/cache/apk/* \
    && mkdir -pv /opt/apps /opt/pro \
    && mkdir -pv /usr/local/openresty/nginx/conf/conf.d \
    && ln -sv /dev/stdout /usr/local/openresty/nginx/logs/access.log  \
    && ln -sv /dev/stderr /usr/local/openresty/nginx/logs/error.log
ADD ./skywalking-nginx-lua.tar.gz /usr/local/openresty

COPY ./nginx.conf /usr/local/openresty/nginx/conf/nginx.conf

WORKDIR /opt/apps
